-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
adding cctp integration test #1601
base: development
Are you sure you want to change the base?
Conversation
haider-rs
commented
Feb 26, 2025
•
edited
Loading
edited
- Add cctp integration test
- Take CCTP contracts list instead of single contract.
ports: | ||
- '8545:8545' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doesn't work in ci...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets please avoid portforwarding
@@ -94,9 +96,13 @@ services: | |||
- '--target-url=ws://chain-2-evm:8545' | |||
- '--network-id=2' | |||
- '--backend=evm' | |||
- '--cctp-sender=000000000000000000000000ab5976445202ac58cdf7da9cb5797a70e6be1cdc' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how is this generated?
let nonce = self.get_gateway_nonce(gateway, contract).await?; | ||
let mut msg = sol::GmpMessage { | ||
srcNetwork: self.network_id, | ||
source: contract.into(), | ||
destNetwork: dest_network, | ||
dest: a_addr(dest), | ||
nonce, | ||
gasLimit: gas_limit as _, | ||
data: cctp_msg.clone().abi_encode().into(), | ||
}; | ||
let call = sol::GmpTester::sendMessageCall { msg: msg.clone() }; | ||
let _ = self.evm_call(contract, call, gas_cost, None, None).await?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why can't you use tc.send_message() here?
// Computing valid message id for CCTP requires adding attestation in the cctp struct and then compute message_id | ||
// Since after getting attestation the message_id of the gmp message changes we get attestation in start to match the later message_id. | ||
let burn_hash: [u8; 32] = sha3::Keccak256::digest(&msg_data).into(); | ||
let response = self.get_cctp_attestation(burn_hash).await?; | ||
let attestation = | ||
response.attestation.ok_or(anyhow::anyhow!("Failed to get msg attestation"))?; | ||
let attestation = attestation.strip_prefix("0x").unwrap_or(&attestation); | ||
let attestation_bytes = hex::decode(attestation).unwrap(); | ||
cctp_msg.attestation = attestation_bytes.into(); | ||
msg.data = cctp_msg.abi_encode().into(); | ||
let message_id = Into::<GmpMessage>::into(msg).message_id(); | ||
Ok(message_id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
message id shouldn't depend on the payload if backends are allowed to change it. since the changed message is tss signed, this isn't a security issue either
async fn deploy_test(&self, gateway: Address, tester: &[u8]) -> Result<(Address, u64)> { | ||
async fn deploy_test( | ||
&self, | ||
_additional_params: &[u8], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?
#[allow(clippy::too_many_arguments)] | ||
pub async fn send_cctp_message( | ||
&self, | ||
src_network: NetworkId, | ||
src_addr: Address, | ||
dest_network: NetworkId, | ||
dest_addr: Address, | ||
gas_limit: u128, | ||
gas_cost: u128, | ||
) -> Result<MessageId> { | ||
let (connector, gateway) = self.gateway(src_network).await?; | ||
let id = self | ||
.println( | ||
None, | ||
format!( | ||
"send cctp message to {} {} with {} gas for {}", | ||
dest_network, | ||
self.format_address(Some(dest_network), dest_addr)?, | ||
gas_limit, | ||
self.format_balance(Some(src_network), gas_cost)?, | ||
), | ||
) | ||
.await?; | ||
let msg_id = connector | ||
.send_cctp_message(gateway, src_addr, dest_network, dest_addr, gas_limit, gas_cost) | ||
.await?; | ||
self.println( | ||
Some(id), | ||
format!( | ||
"sent cctp message {} to {} {} with {} gas for {}", | ||
hex::encode(msg_id), | ||
dest_network, | ||
self.format_address(Some(dest_network), dest_addr)?, | ||
gas_limit, | ||
self.format_balance(Some(src_network), gas_cost)?, | ||
), | ||
) | ||
.await?; | ||
Ok(msg_id) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems like this unnecessarily duplicates send_message
src_addr: Address, | ||
dest: NetworkId, | ||
dest_addr: Address, | ||
smoke_type: SmokeType, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
smoke_type: SmokeType, | |
payload: Vec<u8>, |